package com.cskaoyan.controller;

import com.cskaoyan.exception.SensitiveWordException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2022/06/01 15:53
 */
@RestController
public class HelloController {

    @RequestMapping("hello/{word}")
    public String hello(@PathVariable("word")String word) throws SensitiveWordException {
        if ("songge".equals(word)) {
            throw new SensitiveWordException("敏感词，不允许使用", word);
        }
        int i = 1 / 0;
        return "hello";
    }
}
